home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PASCAL / 0195.ZIP / SAFEWRIT.LIB < prev    next >
Text File  |  1984-12-02  |  1KB  |  29 lines

  1. {@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
  2. The purchaser of these procedures and functions may include them in COMPILED
  3. programs freely, but may not sell or give away the source text.
  4.  
  5. If you try to WRITE a byte that represents a control character, it may play
  6. havoc with your output.  SAFEWRITE writes the equivalent letter value in
  7. low video--e.g., chr(1) equals Control-A, so it prints as a dim A
  8.  
  9. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
  10.  
  11. {==============================================================}
  12. procedure SafeWrite(A: byte);
  13.   begin
  14.     LowVideo;
  15.     case A of
  16.          0: write('@');
  17.      1..26: write(chr(A + 64));
  18.         27: write('[');
  19.         28: write('\');
  20.         29: write(']');
  21.         30: write(chr(24));
  22.         31: write(chr(25));
  23.      else
  24.        HighVideo;
  25.        write(chr(A));
  26.      end;   {case}
  27.     HighVideo;
  28.   end;
  29. {==============================================================}